home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 September
/
Macworld (1998-09).dmg
/
Shareware World
/
Info
/
For Developers
/
Script Tools 1.3.6
/
Examples
/
Regular Expression Example
< prev
next >
Wrap
Text File
|
1993-07-08
|
718b
|
22 lines
--
-- Allow the user to select the folder to be processed. Note that the Choose Folder command
-- is provided by the Script Tools package
--
set folderPath to choose folder¬
with prompt "Select a folder with files to scan:"
set theExpression to compile regular expression "(.*)\\.([chr])$"
set theFiles to list folder folderPath
set theNewFiles to {}
--
-- Look at each file in the folder and do the appropriate substitutions
--
repeat with i from 1 to count of theFiles
set theNewFiles to theNewFiles & (substitute regular expression theExpression ¬
of (item i of theFiles) ¬
with "\\1.\\2 - save")
end repeat
{original:theFiles, New:theNewFiles}
-- Check the result window to see the effects of this script